package com.zfzs.post.modules.merchant.rest;

import com.zfzs.post.aop.log.Log;
import com.zfzs.post.common.bean.ResponseResult;
import com.zfzs.post.modules.merchant.service.MerchantService;
import com.zfzs.post.modules.merchant.service.MerchantWebService;
import com.zfzs.post.modules.merchant.service.dto.MerchantDTO;
import com.zfzs.post.modules.merchant.service.dto.MerchantQueryCriteria;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 商户报备管理
 *
 * @author ck
 * @date 2019-11-12
 */
@RestController
@RequestMapping("merchants")
public class MerchantWebController {

    @Autowired
    private MerchantWebService merchantWebService;

    @Autowired
    private MerchantService merchantService;


    /**
     * 代理商列表
     *
     * @param criteria
     * @param page
     * @param size
     * @return
     */
    @Log("代理商列表")
    @GetMapping(value = "/merchant_list")
    public ResponseResult getAgentInfoPage(MerchantQueryCriteria criteria, Integer page, Integer size) {
        return ResponseResult.ok(merchantWebService.getMerchantInfoPage(criteria, page, size));
    }

    /**
     * 删除
     *
     * @param id
     * @return
     */
    @Log("删除")
    @DeleteMapping(value = "/delete/{id}")
    public ResponseResult delete(@PathVariable Long id) {
        merchantService.delete(id);
        return ResponseResult.ok();
    }
}